package cn.com.taiji.oospub.wechat.service.impl;

import cn.com.taiji.oospub.wechat.entity.Courses;
import cn.com.taiji.oospub.wechat.entity.MealTime;
import cn.com.taiji.oospub.wechat.mapper.MealTimeMapper;
import cn.com.taiji.oospub.wechat.service.IMealTimeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yzd
 * @since 2020-10-28
 */
@Service
public class MealTimeServiceImpl extends ServiceImpl<MealTimeMapper, MealTime> implements IMealTimeService {
    @Autowired
    private MealTimeMapper mealTimeMapper;

    @Override
    public MealTime findByProper(String columnName, String value) {
        QueryWrapper<MealTime> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("code", value);
        return mealTimeMapper.selectOne(queryWrapper);
    }

    @Override
    public MealTime findByProper(String columnName, Courses courses) {
        QueryWrapper<MealTime> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("code", courses.getMealTimeCode());
        queryWrapper.eq("mealType", courses.getType());
        return mealTimeMapper.selectOne(queryWrapper);
    }
}
